using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace XNA_InputTest
{
    public class TestSuite : Microsoft.Xna.Framework.Game
    {
        // Globals
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        SpriteFont font;
        Keys[] heldKeys;

        public TestSuite()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            font = Content.Load<SpriteFont>("CourierNew");
            spriteBatch = new SpriteBatch(GraphicsDevice);
        }

        protected override void UnloadContent()
        {
        }

        protected override void Update(GameTime gameTime)
        {
            // Get keyboard input
            heldKeys = Keyboard.GetState().GetPressedKeys();

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();

            Vector2 point = new Vector2(0);

            for (int i = 0; i < heldKeys.Length; i++)
            {
                spriteBatch.DrawString(font, heldKeys[i].ToString(), point, Color.White);
                point.Y += 16;
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}
